﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="adminProductClass.aspx.cs" Inherits="Admin_adminProductClass"   EnableViewState="false" %>

<%@ Register Src="adminfoot.ascx" TagName="adminfoot" TagPrefix="uc1" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>产品类别管理</title>
    <link rel="stylesheet" href="imgs/admin.css" type="text/css" media="all" />
    <script type="text/javascript" src="../DotNet_net/js/jquery-1.3.2.min.js"></script>
     <script type="text/javascript" src="imgs/GetAjax.js"></script>
    <script type="text/javascript" src="../DotNet_net/js/common.js"></script>

</head >
<body onload="$('#loading').hide()">
  <form id="form1" runat="server">   
    <div class="container" id="cpcontainer">    
 <div id="loading" style="display:block">   
    <div class="loading-indicator">   
        页面正在加载中...   
    </div>   
</div>  
        <table class="tb2">
         <tr class="thead"><th colspan="7">分类管理(<font color='red'>＊</font>为必填,其它选填)</th></tr>	
        <tr align="center">
			<td align="left" width="20%">ID.分类名称(产品数量)</td>
			<td width="14%">类别名</td>
			<td width="10%">别名(标签)</td>
            <td width="16%">类别简述</td>
			<td width="6%">排序</td>
			<td width="13%">&nbsp;操作</td>		
        </tr>
        </table>
        <%=bindProductClassList(0,0,new StringBuilder()) %>
       
   <table class="tb" id="tbS"><tr><td style="height: 38px">全选<input type="checkbox" name="chkall" id="chkall" class="checkbox" onclick="checkAll(this.checked,'m_id')" />反选<input type="checkbox" name="chkothers" id="chkothers" class="checkbox" onclick="checkOthers('m_id')" />
  <input type="button" value="批量修改选中分类" class="btn" onclick="doPostEdit('','m_id')" id="Button1"/>&nbsp;&nbsp;&nbsp;移动到<%=ProductClassDp("yidong")%><input type="button" value="批量移动分类" name="button" class="btn" onclick="doPostMove('','m_id');"/></td><td> <input type="button" value="批量删除" onclick="doPostDeletes('','m_id')" class="btn"  style="float:right; color:Red;" />
   </td></tr></table>
    <table class="tb mt20" id="insertTb">
    <tr class="thead"><th colspan="8">添加分类</th></tr>	
        <tr align="center">
            <td width="305" align=left>
            选择层级：<%=ProductClassDp("insert")%>
            </td>
            <td  width="253">类别名
              <input size="13" type="text" name="m_pcname" ><font color='red'>＊</font></td>
            <td  width="162"   >别名(标签)
              <input size="10" type="text" name="m_pcTage"></td>
            <td  width="207">类别简述
              <input size="12" type="text" name="m_pcinfo"></td>
            <td width="136">排序
              <input size="3" type="text" name="m_pcsort"><font color='red'>＊</font></td>
            <td width="175">
        <input type="button" value="添 加" class="btn"  onclick="doPostInsert('')"/></td>
    </tr>
</table>
 <uc1:adminfoot ID="Adminfoot1" runat="server" />
    </div>
     

</form>

    <script type="text/javascript">
    function  doPostDeletes(url,sname)
    {    
       
        var ids=getIDList(sname);
        if(ids!="")
        {
            if((confirm("确定要删除这些记录?"))==true)
            { $("#loading").show();
                url=convertURL(url+"?action=delAll&id="+ids);
//                location.href=url
                $("#loading").show();
                ajax_get(url,'',function(msg)
                {
                    $("#cpcontainer").empty().append(msg);
                    $("#loading").hide();
                });
	        }
	    }
	    else
	    {
	        alert("您还没有选择要删除的项");	      
	        return false;
	    }
    }
    function  doPostEdit(url,sname)
    {    
       
        var ids=getIDList(sname);
        var Param='';
        if(ids!="")
        {
            if((confirm("确定要批量修改这些记录?"))==true)
            { $("#loading").show();
                  url=url+"?action=editAll&id="+ids; 
                  for(var i=0;i<=ids.split(',').length-1;i++)
                  { 
                     var id=ids.split(',')[i];
                     Param+= "&pcname"+id+"="+$("input[name='pcname"+id+"']").attr("value")+
                             "&pcTag"+id+"="+$("input[name='pcTag"+id+"']").attr("value")+
                             "&pcinfo"+id+"="+$("input[name='pcinfo"+id+"']").attr("value")+
                             "&pcsort"+id+"="+$("input[name='pcsort"+id+"']").attr("value")+
                             "&pFid"+id+"="+$("input[name='pFid"+id+"']").attr("value");
                  }
                  $("#loading").show();
                    ajax_post(url,Param,function(msg){$("#cpcontainer").empty().append(msg);
                    $("#loading").hide();
                 });
	        }
	    }
	    else
	    {
	        alert("您还没有选择要修改的项");	      
	        return;
	    }
    }
    
    function doPostInsert(url)
    {
        $("#loading").show();
        var Datalist='';
        var pid="";
        pid=document.getElementById("insert").options[document.getElementById("insert").selectedIndex].value;
        //alert(document.getElementById("yidong").options[document.getElementById("yidong").selectedIndex].value)
        url=url+"?action=Insert&id="+pid;
        Datalist+= "&pcname="+$("input[name=m_pcname]").attr("value")+
                   "&pcTag="+$("input[name=m_pcTage]").attr("value")+
                   "&pcinfo="+$("input[name=m_pcinfo]").attr("value")+
                   "&pcsort="+$("input[name=m_pcsort]").attr("value");
                   $("#loading").show();
         ajax_post(url,Datalist,function(msg){$("#cpcontainer").empty().append(msg);
         $("#loading").hide();  
       })
    }
    function doPostMove(url,sname)
    {
     
        var ids=getIDList(sname);
        if(ids!="")
        {
            var yidong="";
            var Param="";
            yidong=document.getElementById("yidong").options[document.getElementById("yidong").selectedIndex].value;
            if((confirm("确定要移动这些记录?"))==true)
            {   $("#loading").show();
                url=convertURL(url+"?action=MoveAll&id="+yidong+"&pcid="+ids);
               $("#loading").show();
                ajax_get(url,'',function(msg)
                {
                    $("#cpcontainer").empty().append(msg);
                    $("#loading").hide();
                });
	        }
	    }
	    else
	    {
	        alert("您还没有选择移动项");	       
	        return false;
	    }
    }
    
    </script>
</body>
<script type="text/javascript">
function GivePower(tg,title)
{
   var  el=$(tg).prev()[0];
   _1=el;openWindow2(20,420,400,0);
	var msgDiv=document.getElementById("msg");
	var _t = tg.offsetTop;
    var _l = tg.offsetLeft;
    while (tg = tg.offsetParent){_t+=tg.offsetTop; _l+=tg.offsetLeft;}
    msgDiv.style.cssText+="border:1px solid #55BBFF;background: #C1E7FF;padding:1px 0px 1px 1px;height: auto;"
	msgDiv.style.top = (_t-1)+"px";
    msgDiv.style.left = (_l-1)+"px";
	msgDiv.innerHTML='<button type="button" class="btn" style="margin:0 6px 0 0;height:23px;float:right;padding:0;" onclick="closeWin()">关闭</button><iframe src="FileDownLoad/selectRole.aspx?type=1&productId='+title+'" scrolling="no" topmargin="0"  height:auto;overflow:auto;  marginwidth="0" marginheight="0" frameborder="0" align="center"  onload="this.height=this.contentWindow.document.documentElement.scrollHeight"></iframe>';
}
</script> 
</html>
